<template>
  <div>
    <!-- 面包屑 -->
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>权限管理</el-breadcrumb-item>
      <el-breadcrumb-item>权限列表</el-breadcrumb-item>
    </el-breadcrumb>
    <home-main-template>
        <template slot="center">
            <el-table :data="rightsList" border stripe>
                <el-table-column type="index"></el-table-column>
                <el-table-column label="权限名称" prop="authName"></el-table-column>
                <el-table-column label="路径名称" prop="path"></el-table-column>
                <el-table-column label="权限等级" prop="level">
                    <template slot-scope="scope">
                        <el-tag v-if="scope.row.level === '0'">一级</el-tag>
                        <el-tag v-if="scope.row.level === '1'" type="success">二级</el-tag>
                        <el-tag v-if="scope.row.level === '2'" type="warning">三级</el-tag>
                    </template>
                </el-table-column>
            </el-table>
        </template>
    </home-main-template>
  </div>
</template>

<script>
import HomeMainTemplate from "../../../../../components/content/HomeMainTemplate.vue";
import {getRightList} from "@/network/right";
export default {
  components: { HomeMainTemplate },
  name: "Rights",
  data() {
      return {
          //权限列表
          rightsList:[]
      }
  },
  created() {
      //获取所有权限
      this.getRight()
  },
  methods: {
      getRight(){
          getRightList().then(
              res =>{
                  const {data,meta} = res
                  if(meta.status !== 200) return  this.$message.error(meta.msg)
                  this.rightsList = data
              }
          )
      }
  },
};
</script>
<style scoped>
.el-breadcrumb {
  margin-bottom: 15px;
}
</style>